﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using YArchitech.LIB;
using YArchitech.LIB.YJKControls;

namespace YJKRevitArea.AreaSet
{
	public partial class InsideAreaSetForm : System.Windows.Forms.Form
	{
		public InsideAreaSetForm(InsideAreaLableInfo labelInfo)
		{
			this.InitializeComponent();
			this.m_labelInfo = labelInfo;
			this.chkHouseName.Checked = labelInfo.m_labelHouseName;
			this.chkHouseNum.Checked = labelInfo.m_labelHouseNum;
			this.chkUnit.Checked = labelInfo.m_labelUnit;
			this.chkBuildingNum.Checked = labelInfo.m_labelBuildingNum;
			this.chkInsideArea.Checked = labelInfo.m_labelInsideArea;
			if ("平方米" == labelInfo.m_labelLanguage)
			{
				this.radChinese.Checked = true;
			}
			else
			{
				this.radEnglish.Checked = true;
			}
			if (labelInfo.m_RangeType == "KeepWarm")
			{
				this.KeepWarmBtn.Checked = true;
				return;
			}
			if (labelInfo.m_RangeType == "StrCenter")
			{
				this.StrCenterBtn.Checked = true;
				return;
			}
			if (labelInfo.m_RangeType == "Structure")
			{
				this.StructureBtn.Checked = true;
				return;
			}
			if (labelInfo.m_RangeType == "")
			{
				this.KeepWarmBtn.Checked = true;
			}
		}

		private void InsideAreaSetForm_Load(object sender, EventArgs e)
		{
			//base.Icon = Resource.YArchitechIcon;
		}

		private void btnOk_Click(object sender, EventArgs e)
		{
			this.m_labelInfo.m_labelHouseName = this.chkHouseName.Checked;
			this.m_labelInfo.m_labelHouseNum = this.chkHouseNum.Checked;
			this.m_labelInfo.m_labelUnit = this.chkUnit.Checked;
			this.m_labelInfo.m_labelBuildingNum = this.chkBuildingNum.Checked;
			this.m_labelInfo.m_labelInsideArea = this.chkInsideArea.Checked;
			if (this.radChinese.Checked)
			{
				this.m_labelInfo.m_labelLanguage = "平方米";
			}
			else
			{
				this.m_labelInfo.m_labelLanguage = "m2";
			}
			if (this.KeepWarmBtn.Checked)
			{
				this.m_labelInfo.m_RangeType = "KeepWarm";
				return;
			}
			if (this.StrCenterBtn.Checked)
			{
				this.m_labelInfo.m_RangeType = "StrCenter";
				return;
			}
			if (this.StructureBtn.Checked)
			{
				this.m_labelInfo.m_RangeType = "Structure";
			}
		}

		private void KeepWarmBtn_Click(object sender, EventArgs e)
		{
			this.RangeType = "KeepWarm";
		}

		private void StrCenterBtn_Click(object sender, EventArgs e)
		{
			this.RangeType = "StrCenter";
		}

		private void StructureBtn_Click(object sender, EventArgs e)
		{
			this.RangeType = "Structure";
		}

		protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
		{
			int num = 256;
			int num2 = 260;
			if ((msg.Msg == num | msg.Msg == num2) && keyData == Keys.Escape)
			{
				base.Close();
			}
			return false;
		}

		public InsideAreaLableInfo m_labelInfo;

		public string RangeType = "KeepWarm";
	}
}
